<?php
	//session_start();

	function PrintProperty( $rowDetail, $nIdx )
	{// URL, Price,idListing
				echo '<a class="ViewDetailBlock" id="'.$rowDetail['idResidentialProperty'].'" href="#page14" data-transition="slide" style="text-decoration: none; color: #000000;">';
		echo '<div class="ui-grid-a ">';
			echo '<div class="ui-block-a property-image" style="position: relative" id="'.$rowDetail['Latitude'].'">';
 				echo '<div class="property-image-canvas" style="position: absolute;">';

				if( file_exists($rowDetail['URL'].$rowDetail['idListing'].'-1.jpeg') )
				{
					echo '<img src="http://23.21.84.9/'.$rowDetail['URL'].$rowDetail['idListing'].'-1.jpeg" HSPACE="0" class="ListImage"/>';//.$_SESSION['Host']
				}
				else
				{
					echo '<img src="http://23.21.84.9/images/sample-property.jpg" HSPACE="0" class="ListImage"/>';
				}//$_SESSION['Host'].
				echo '</div>';
//				echo '<div style="background-image: url('.$_SESSION['Host'].$_SESSION['ImagePath'].$rowDetail['idListing'].'-1.jpeg); width: 100px; height: 75px; position: absolute;">';
				//echo '<img src="'.$_SESSION['Host'].$_SESSION['ImagePath'].$rowDetail['idListing'].'-1.jpeg"/>';
           			echo '<div class="property-image-text" style="position: absolute; right:4.9%; bottom:-1px;">';
//	        			echo '<font size="2" style="background-color:#00ff00;">$'.$rowDetail['Currency'].'</font>';
		include_once("PriceString.php");
		echo '<font size="2"  class="ListPrice">'.NumberToPrice($rowDetail['Price'])."</font>";//style="background-color:#00ff00;"

					echo '</div>';
//					echo '<img src="'.$_SESSION['Host'].$_SESSION['ImagePath'].$rowDetail['idListing'].'-1.jpeg" class="property-image-src"/>';
//				ImageWithPrice( $_SESSION['Host'].$_SESSION['ImagePath'].$rowDetail['idListing'].'-1.jpeg', $rowDetail['Currency']);
//				echo '</div>';
			echo '</div>';
		
		$strAddress = $rowDetail['StreetNumber']. '+'.$rowDetail['StreetName'] . '+' . $rowDetail['City'];// . '+' . $rowDetail['StateOrProvince'];
		if($nIdx == 0)
		{
			$_SESSION["MapAddress"] .= $strAddress . "&zoom=11&size=288x400";
		}
//		$nIdx++;
		$_SESSION["MapAddress"] .= "&markers=label:".$nIdx."%7C".$strAddress;		
//		$strSqlCommand = "SELECT ThePrice FROM Price
//						  WHERE idPrice = ".$rowDetial[1];		
//		$resultPrice = mysql_query($strSqlCommand);
//		$rowPrice = @mysql_fetch_row($resultPrice);

			echo '<div class="ui-block-b property-description" id="'.$rowDetail['Longitude'].'">';
				echo '<div class="ListAddress" style="padding-bottom:0;">';
//					echo "<p>".$rowDetail['StreetNumber']." ".$rowDetail['StreetName']." ".$rowDetail['UnitNumber']."</p>";
//					echo "<p>".$rowDetail['City'].", ".$rowDetail['StateOrProvince'].", ".$rowDetail['PostalCode']."</p>";
					echo "<p>".$rowDetail['StreetNumber']." ".$rowDetail['StreetName']."</p>";
					echo "<p>".$rowDetail['City'].", ".$rowDetail['PostalCode']."</p>";
					//echo "<p>".$rowType[0]." Bedrooms, ".$rowType[1]." Bathrooms</p>";
					if($rowDetail['Bedrooms'] == "")
						$rowDetail['Bedrooms'] = "0";
//					echo "<p>".$rowDetail['Bedrooms']." Bedrooms, ".$rowDetail['BathTotal']." Bathrooms</p>";
				echo '</div><div style="padding-top:0;">';					
					echo '<p>';
					if($rowDetail['Bedrooms'] > 0 )
					{	
						$strOutput = $rowDetail['Bedrooms']." Bedrooms";
							if($rowDetail['BathTotal'] > 0){ $strOutput .= ", ".$rowDetail['BathTotal']." Bathrooms"; }
								echo $strOutput;
							}
							else if( $rowDetail['BathTotal'] > 0 )
							{
								echo $rowDetail['BathTotal']." Bathrooms";
					}
					else echo "<br/>";
					echo '</p>';					
					
//					echo "<p>".$rowDetail['Currency']."</p>";
//				echo "</div>";
//				echo '<div>';
					include_once( "getLatLong.php" );
					$geoLatLon = getLatLong( $rowDetail['StreetNumber']." ".$rowDetail['StreetName']." ".$rowDetail['UnitNumber'].
										" ".$rowDetail['City']." ".$rowDetail['StateOrProvince']." ".$rowDetail['PostalCode'] );
					$lat = $geoLatLon['lat'];
					$long = $geoLatLon['long'];
/*					
					include("http://www.bespoke-app.com/Realty/WorkScoreAPI.php?lat=$lat&lon=$long");
/*/
					echo "<p>Walk Score: ".rand(80,95)."</p>";
//*/					
//					getWalkScore( $geoLatLon['lat'], $geoLatLon['long'], 
//										$rowDetail['StreetNumber']." ".$rowDetail['StreetName']." ".$rowDetail['UnitNumber'].
//										" ".$rowDetail['City']." ".$rowDetail['StateOrProvince']." ".$rowDetail['PostalCode'] );
					//echo $json;
					
				echo "</div>";
				
		//$_SESSION["PropertyId"] = $rowType[2];
//		$_SESSION["PropertyId"] = $rowDetial[4];
//			$strAddress = $rowAddress[1]. ' '.$rowAddress[3] . ' ' . $rowAddress[5] . ' ' . $rowAddress[6];
//		$_SESSION["MapAddress"] = str_replace( " ","+", $strAddress);
			//echo '<input type="hidden" id="Property" value="'.$rowType[2].'">';
			//echo '<input type="hidden" class="Property" value="'.$rowDetial[4].'">';
			echo '</div>';
		echo '</div>';//class="ui-grid-a"
				echo '</a>';
			
/*	
		echo '<div class="ui-grid">';
			echo '<a data-role="button" data-transition="slide" href="#page14" class="ui-btn ui-shadow ui-btn-corner-all ui-btn-up-c PropertyDetail">';
			// data-corners="true" data-shadow="true"
			//data-iconshadow="true" data-iconsize="18" data-wrapperels="span" data-theme="c" 
			//
			echo '<input type="hidden" value="'.$rowDetial[4].'" class="Property"/>';
			echo '<span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">';
			echo "View Details";
			echo '</span></span>';
			echo '</a>';
		
		echo '</div>';
*/	//echo '</div>';//<!-- /grid-a -->";//<div><p></p></div>';
		//

	}
	
?>